<?php

namespace App\Enums\OpenShop\Merchant;

class CacheEnum
{
    public static function jwtCacheKey(string $jwt)
    {
        return 'open_shop_merchant:jwt_user_info_' . md5($jwt);
    }

    public static function jwtMergeCacheKey(string $jwt)
    {
        return 'open_shop_merchant:jwt_merge_' . md5($jwt);
    }

    /**
     * @param string $jwt
     * @param int $shopId
     * @return string
     */
    public static function jwtWithShopIdMergeCacheKey(string $jwt, int $shopId): string
    {
        return vsprintf("open_shop_merchant:jwt:%s:shopId:%d", [md5($jwt) , $shopId]);
    }

    public static function permissionCacheKey(int $rmsUserId, int $shopId, $brandId)
    {
        return "open_shop_merchant:user_permissions_{$rmsUserId}_{$shopId}_{$brandId}";
    }

    public static function shopListCacheKey(string $jwtToken, int $shopId, int $brandId)
    {
        return 'open_shop_merchant:jwt_user_shop_list_' . md5($jwtToken) . "_{$shopId}_{$brandId}";
    }
}
